package com.wc.AlgoOJ_train.train1.c5.A502;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/1/10 20:09
 * @description Rectangles
 * http://43.138.190.70:8888/p/A502
 */
public class Main {
    static double x1, x2, x3, x4;
    static double y1, y2, y3, y4;
    static double tmp;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNextDouble()) {
            x1 = sc.nextDouble();
            y1 = sc.nextDouble();
            x2 = sc.nextDouble();
            y2 = sc.nextDouble();
            x3 = sc.nextDouble();
            y3 = sc.nextDouble();
            x4 = sc.nextDouble();
            y4 = sc.nextDouble();
            System.out.printf("%.2f\n", calIntersection());
        }
    }

    static double calIntersection() {
        if (x1 > x2) {
            tmp = x1;
            x1 = x2;
            x2 = tmp;
        }
        if (x3 > x4) {
            tmp = x3;
            x3 = x4;
            x4 = tmp;
        }
        if (y1 > y2) {
            tmp = y1;
            y1 = y2;
            y2 = tmp;
        }
        if (y3 > y4) {
            tmp = y3;
            y3 = y4;
            y4 = tmp;
        }
        // 没有重叠
        if (x1 >= x4 || x2 <= x3 || y1 >= y4 || y2 <= y3) {
            return 0;
        }
        // 重叠
        double x = Math.min(x2, x4) - Math.max(x3, x1);
        double y = Math.min(y2, y4) - Math.max(y3, y1);
        return x * y;
    }
}
